// 判断一个对象是不是数组
export module JudgeAnArray{
    let str:string = 'hello';
    let strs:string[] = ['sss', 'www', 'ggg']
    let obj:Object = { name: 'sss' }
    let flag: Boolean = true;

    // typeof 仅能将数组和其他非对象的数组类型区分开来，不能区分数组和对象
    console.log('typeof string: ',typeof str);
    console.log('typeof string[]: ',typeof strs);
    console.log('typeof Object: ',typeof obj);
    console.log('typeof boolean: ',typeof flag);  

    console.log(Object.getPrototypeOf(str).constructor.name);
    console.log(Object.getPrototypeOf(strs).constructor.name);
    console.log(Object.getPrototypeOf(obj).constructor.name);

    console.log(Array.isArray(str)); 
    console.log(Array.isArray(strs)); 
    console.log(Array.isArray(obj));    

}
